package com.jt.blackwhite;
/*《授权规则----黑白名单》
定义[请求解析器],用于对请求进行解析,并返回解析结果
定义RequestOriginParser接口的实现类，基于业务在接口方法中解析请求数据并返回.
 */
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
@Component
public class DefaultRequestOriginParser implements RequestOriginParser {
     //http://localhost:8090/consumer/test?origin=app1
    public String parseOrigin(HttpServletRequest request) {
        return request.getParameter("origin");

    }
}
